pull: Hopefully squash race where we would exit early
authorColin Walters <walters@verbum.org>
Sun, 19 Jan 2014 23:12:44 +0000 (18:12 -0500)
committerColin Walters <walters@verbum.org>
Sun, 19 Jan 2014 23:12:44 +0000 (18:12 -0500)
commit3cd866556c1163128ca2310d38fb4e3cd43d39e2
treea5db515d821c70dca5836889f22dd8da19b2e942
parent3802a0679b5b0ef7a434c09e2c16b97141fe1cee
pull: Hopefully squash race where we would exit early

This is a redesign (again) of the pull code.  It is simpler and
survives 20 minutes of testing in a loop, whereas the old code would
only go from 30 seconds to 2 minutes.

The problem with the old code was that there was a race where we might
determine idle state even when there are content requests in flight
between the metadata thread and the main one.

This code majorly reworks things - there's now only one IDLE message,
sent in a circle from the main thread, through the metadata scanner,
and back to the main one.

Crucially it's only sent when the *main* thread is idle.  Previously
we were looking at whether the metadata scanner is idle, but that
doesn't make a lot of sense.  First let's make sure the main thread is
idle, then verify that the metadata one is.

This closes the loop because we'll have ensured we get any pending
requests.

https://bugzilla.gnome.org/show_bug.cgi?id=706456
src/libostree/ostree-repo-pull.c